<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    
    "modules" => [
        //yii2-admin   
	    "admin" => [        
	        "class" => "mdm\admin\Module",
            'layout' => 'left-menu',
	    ],

        //redactor editor
        'redactor' => [ 
            'class' => 'yii\redactor\RedactorModule', 
            'uploadDir' => '@root_path/common/upload/article', 
            'uploadUrl' => '/common/upload/article', 
            'imageAllowExtensions'=>['jpg','png','gif'] 
        ],
	],
	"aliases" => [    
	    "@mdm/admin" => "@vendor/mdmsoft/yii2-admin",
	],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        
        'urlManager' => [
            'enablePrettyUrl' => false,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
        
        "authManager" => [        
	        "class" => 'yii\rbac\DbManager', //这里记得用单引号而不是双引号        
	        "defaultRoles" => ["guest"],    
	    ],
    ],

    //严重警告！！！as access位置不要添加错了，已经不少同学都掉坑里了！！！
	'as access' => [
	    'class' => 'mdm\admin\components\AccessControl',
	    'allowActions' => [
	        //这里是允许访问的action
	        //controller/action
	    	//'*',
	    ]
	],
    'params' => $params,

    'language' => 'zh-CN',
];
